#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton*button1=new QPushButton("按钮",this);
    QPushButton*button2=new QPushButton("状态切换",this);
    button1->move(200,300);
    button2->move(200,400);
    //button1->setEnabled(false);
    connect(button2,&QPushButton::clicked,button1,[=](){
        bool status=button1->isEnabled();
        button1->setEnabled(!status);
    });

    qDebug()<<"button1 enabled: "<<button1->isEnabled();
    qDebug()<<"button2 enabled: "<<button2->isEnabled();

}

Widget::~Widget()
{
    delete ui;
}
